package org.easy.module.service.impl;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.easy.common.domain.SysDictDataDO;
import org.easy.common.domain.SysDivisionsDO;
import org.easy.common.domain.SysUserDO;
import org.easy.module.mapper.SysDictDataMapper;
import org.easy.module.mapper.SysDivisionsMapper;
import org.easy.module.mapper.SysUserMapper;
import org.easy.module.service.TestService;
import org.easy.module.service.TestService1;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.concurrent.*;

/**
 * 测试service实现类
 *
 * @Author ZhouZhiXin
 * @Date 2022/10/21 15:55
 */
@Slf4j
@Service
public class TestServiceImpl1 implements TestService1 {

    @Autowired
    SysDictDataMapper sysDictDataMapper;
    @Autowired
    SysDivisionsMapper sysDivisionsMapper;
    @Autowired
    SysUserMapper sysUserMapper;

    @Transactional
    @Override
    public void testTransactional(SysDictDataDO sysDictDataDO) {
        sysDictDataMapper.updateDataDescById("4", sysDictDataDO.getId());
        double d = 1 / 0;
    }

    @Transactional(propagation = Propagation.REQUIRES_NEW)
    @Override
    public void updateData(SysDictDataDO sysDictDataDO) {
        sysDictDataMapper.updateDataDescById("8",sysDictDataDO.getId());
    }

}
